// POJ 2553


#include <iostream>
#include <vector>
#include <algorithm>
#include <cassert>
using namespace std;

// 0-based index
class DirectedGraph
{
public:
	typedef vector<vector<int> > AdjList;
public:
	DirectedGraph(int size) : nodeCount(size), edgeCount(0)
	{
		g.resize(nodeCount);
		gr.resize(nodeCount);
		nodeSet.resize(nodeCount, -1);
	}

	void addEdge(int a, int b)
	{
		++edgeCount;
		g[a].push_back(b);
		gr[b].push_back(a);
	}

	int getNodeCount() const
	{
		return nodeCount;
	}

	void runKosarajuAlgorithm()
	{
		visited.assign(nodeCount, false);
		for (int i = 0; i < gr.size(); ++i)
			dfsA(i);

		assert(seq.size() == nodeCount);
		no = 0;
		visited.assign(nodeCount, false);
		for (int i = seq.size() - 1; i >= 0; --i)
		{
			int node = seq[i];
			if (visited[node] == false)
			{
				dfsB(node);
				++no;
			}
		}
	}
	
	int getNodeSetIndex(int node) const
	{
		return nodeSet[node];
	}

	AdjList getDAG()
	{
		AdjList res(no);
		for (int i = 0; i < g.size(); ++i)
			for (int j = 0; j < g[i].size(); ++j)
			{
				int a = nodeSet[i], b = nodeSet[g[i][j]];
				if (a != b)
					res[a].push_back(b);
			}
		return res;
	}

private:
	void dfsA(int node)
	{
		if (visited[node] == false)
		{
			visited[node] = true;
			for (int i = 0; i < gr[node].size(); ++i)
				dfsA(gr[node][i]);
			seq.push_back(node);
		}
	}

	void dfsB(int node)
	{
		if (visited[node] == false)
		{
			visited[node] = true;
			for (int i = 0; i < g[node].size(); ++i)
				dfsB(g[node][i]);
			nodeSet[node] = no;
		}
	}

private:
	int nodeCount;
	int edgeCount;
	AdjList g, gr;

	// tmp
	vector<bool> visited;
	vector<int> seq;
	int no;

	// result
	vector<int> nodeSet;
};

int main()
{
	int v, e;
	while (scanf("%d", &v) && v != 0 && scanf("%d", &e))
	{
		DirectedGraph dg(v);
		for (int i = 0; i < e; ++i)
		{
			int a, b;
			scanf("%d%d", &a, &b);
			--a, --b;
			dg.addEdge(a, b);
		}
		dg.runKosarajuAlgorithm();
		DirectedGraph::AdjList dag = dg.getDAG();
		vector<int> sinkSet;
		for (int i = 0; i < dag.size(); ++i)
			if (dag[i].size() == 0)
				sinkSet.push_back(i);

		vector<int> res;
		for (int i = 0; i < dg.getNodeCount(); ++i)
		{
			if (find(sinkSet.begin(), sinkSet.end(), dg.getNodeSetIndex(i)) != sinkSet.end())
				res.push_back(i);
		}
		sort(res.begin(), res.end());
		for (int i = 0; i < res.size(); ++i)
			printf("%d ", res[i] + 1);
		printf("\n");
	}
	system("pause");
	return 0;
}